<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>班级录入</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="/qcby/layuiadmin/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="/qcby/layuiadmin/style/admin.css" media="all">
  <link rel="stylesheet" href="/qcby/layuiadmin/style/login.css" media="all">
  <link href="/qcby/favicon.ico" rel="shortcut icon" />

</head>
<body>

  <div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login" style="display: none;">
    <div class="layadmin-user-login-main">
      <div class="layadmin-user-login-box layadmin-user-login-header">
        <h2>课程录入</h2>
      </div>
      <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
        <div class="layui-form-item">
          <label class="layadmin-user-login-icon layui-icon layui-icon-username" for="LAY-user-login-nickname"></label>
          <input type="text" name="claName" id="LAY-user-login-user" placeholder="班级" class="layui-input">
        </div>
        <div class="layui-form-item">
          <label class="layadmin-user-login-icon layui-icon layui-icon-username" for="LAY-user-login-nickname"></label>
          <input type="text" name="claProject" id="LAY-user-login-nickname" placeholder="课程名" class="layui-input">
        </div>

        <div class="layui-form-item">
          <button class="layui-btn layui-btn-fluid" lay-submit lay-filter="LAY-user-reg-submit">添　加</button>
        </div>

      </div>
    </div>

    <div class="layui-trans layadmin-user-login-footer">
      
      <p>© 2020 <a href="http://www.layui.com/" target="_blank">layui.com</a></p>
      <p>
        <span><a href="http://www.layui.com/admin/#get" target="_blank">获取授权</a></span>
        <span><a href="http://www.layui.com/admin/pro/" target="_blank">在线演示</a></span>
        <span><a href="http://www.layui.com/admin/" target="_blank">前往官网</a></span>
      </p>
    </div>

  </div>
  <script src="/qcby/layuiadmin/layui/layui.js"></script>
  <script>
    layui.config({
      base: '/qcby/layuiadmin/' //静态资源所在路径
    }).extend({
      index: '/lib/index' //主入口模块
    }).use(['index', 'user','layer'], function(){
      var $ = layui.$
              ,admin = layui.admin
              ,form = layui.form
              ,layer = layui.layer;

      form.render();

      //提交
      form.on('submit(LAY-user-reg-submit)', function(obj){

        layer.open({
          content: '确定加入此课程吗？'
          ,btn: ['确定', '取消']
          ,yes: function(index, layero){
            var field = obj.field;
            //请求接口
            admin.req({
              url: '/qcby/teacher/addclass' //实际使用请改成服务端真实接口
              ,data: field
              ,type:'post'
              ,done: function(res){

                if(res.code == 0){
                  layer.msg('添加成功', {
                    offset: '15px'
                    ,icon: 1
                    ,time: 1000
                  }, function(){

                  });
                }else{
                  layer.alert(res.msg , {icon:2});
                }

              }
            });
          }
        });

        return false;
      });

    });
  </script>
</body>
</html>